home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
asm32.zip
/
TEXT.DOC
< prev
Wrap
Text File
|
1995-07-22
|
33KB
|
1,061 lines
****************************** TEXT MODE *******************************
ASM32 Text mode video subroutines (C) Copyright 1993 - 1995 Douglas Herr
All rights reserved
ASM32 subroutines write directly to the video memory buffer, except
where noted. ASM32 detects the default display type and screen
dimensions. ASM32 assumes that CGA equipment requires "snow" control
and behaves accordingly.
EGA32.LIB, provided with registration, does not include CGA "snow"
control and is somewhat faster and more compact. EGA32.LIB will be
best for most 32-bit PCs, but there are many 386SX and 386DX computers
which were upgraded from 16-bit processors with a variety of video systems.
For this reason ASM32 includes support for a variety of video systems.
Multiple pages of video memory are available except with MDA video adapters.
Pages supported by ASM32 are shown below:
video system screen size ASM32 support BIOS support
------------- ----------- -------------- ---------------
MDA 80 x 25 page 0 page 0
CGA, MCGA 80 x 25 pages 0 - 3 pages 0 - 3
CGA, EGA, VGA 40 x 25 pages 0 - 7 pages 0 - 7
EGA, VGA 80 x 25 pages 0 - 7 pages 0 - 7
EGA 80 x 43 pages 0 - 3 pages 0 - 3
VGA 80 x 50 pages 0 - 3 pages 0 - 3
SEGA, SVGA 132 x 25 pages 0 - 3 pages 0 - 3
SEGA, SVGA 132 x 43 pages 0 & 1 pages 0 & 1
HGC, HGC+, InC 80 x 25 pages 0 - 15 page 0
HGC+, InC 90 x 25 pages 0 - 13 page 0
HGC+, InC 80 x 43 page 0 page 0
HGC+, InC 90 x 43 page 0 page 0
ASM32 subroutines assume that rows are the vertical dimension and
columns are the horizontal dimension of a text-mode screen. The upper
left corner of the screen is at row=0 and col=0
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
ANSICOLOR: determines color attribute used by ANSI device driver.
See also IsANSI.
Source: anscolor.asm
Call with: no parameters
Returns: AH = color attribute
Uses: EAX
Example:
call ansicolor ; get ANSI screen color in AH
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
BLINK: enable or disable blinking attriutes
disable or enable bright background attributes
Source: blink.asm
Call with: AL = 1 for blinking attributes/no bright background attributes
AL = 0 for no blinking attributes/bright background attributes
Returns: nothing
Uses: nothing; all registers and flags are saved
Supports: All ASM32 text modes
Example:
include codeseg.inc
.
.
.
mov al,0
call blink ; turn blinking attributes into bright
; background attributes
.
.
.
mov al,1
call blink ; turn bright background attributes into
; blinking attributes
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CRTINFO: central control for ASM32 Text subroutines; determines
active video system, screen size, page offset.
Source: crtinfo.asm
Call with: AH = 0 for page 0 information
AH = -1 to calculate active page address
Returns: AL = screen rows
CH = screen columns
ES:[EBX] = video buffer address
DX = 3DAh if CGA, 0 if not CGA
DX is used to monitor screen retrace, to avoid "snow"
on older CGA systems.
Uses: ES, AX, EBX, CX, DX, flags
Supports: all ASM32 text modes
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CURSORCOLOR: set cursor color and enable color palette (InColor only)
Source: curscolor.asm ($herc.asm)
Call with: AH = color attribute (1 - 15)
Returns: if CF = 0, no error
if CF = 1, InColor card not installed
Uses: Carry Flag
Supports: Hercules InColor card only
Example:
extrn cursorcolor:proc
.code
.
.
.
mov ah,14 ; bright yellow cursor
call cursorcolor ; enable InColor palette, set cursor color
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CURSOROFF: make hardware cursor invisible at present location
Source: cursor.asm
Call with: no parameters
Returns: nothing
Uses: nothing
Supports: CGA, MDA, HGC, HGC+, InC, EGA, VGA, SEGA, SVGA: text mode
Example: call cursoroff
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CURSORON: move cursor to (row, col) and update cursor shape
Cursor shape is underscore if INSERT is off, larger block
if INSERT is on. See also UCursorON.
Source: cursor.asm (crtinfo.asm)
Call with: DH = row offset from top of screen
DL = column offset from left side
Returns: nothing
Uses: EAX
Supports: CGA, MCGA, MDA, HGC, HGC+, InC, EGA, SEGA, SVGA, VGA: text mode
Example: mov dh,row ; vertical coordinate on text screen
mov dl,column ; horizontal coordinate
call cursoron
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
GETSCREEN: save a screen page to a memory buffer
PUTSCREEN: copy a saved screen page to the video buffer
Source: screen.asm (crtinfo.asm, $wcopy.asm)
Call with: ESI pointing to memory buffer
Returns: nothing
Uses: nothing; all flags and registers are saved
Supports: All ASM32 text modes; includes CGA snow control
Example: see ScreenBytes for example
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
HSCROLL: scroll a portion of the screen left or right.
Source: hscroll.asm ($wdata.asm, $wcopy.asm, a$putw.asm)
Call with: EBX pointing to corner coordinates
AH = color attribute for cleared columns
ECX = number of columns to scroll
scrolls left if ECX > 0, scrolls right if ECX < 0
clears area if ECX = 0
Returns: nothing
Uses: nothing
Supports: All ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,color ; AH = color attribute for cleared columns
mov ecx,columns ; COLUMNS defined elsewhere
call hscroll ; to clear entire window, columns = 0
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
PAINT: change all color attributes on a text-mode screen
without re-printing the text
Source: paint.asm (crtinfo.asm, $paint.asm)
Call with: AH = new color attribute
Returns: nothing
Uses: nothing
Supports: All ASM32 text modes; includes CGA snow control
Example: mov ah,newcolor
call paint
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
RECOLOR: change selected color attributes on a text-mode screen
Replaces oldcolor attribute with newcolor, without
re-printing the text.
Source: recolor.asm (crtinfo.asm, $recolor.asm)
Call with: AL = color to replace
AH = new color attribute
Returns: nothing
Uses: nothing
Supports: All ASM32 text modes; includes CGA snow control
Example: mov al,oldcolor
mov ah,newcolor
call recolor
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
SCREENBYTES: calculate bytes required to save screen page
Used with GetScreen and PutScreen.
Source: scrbytes.asm (crtinfo.asm)
Call with: no parameters
Returns: EAX = number of bytes required
Uses: EAX
Example:
include model.inc
include dataseg.inc
saved_pointer dd ?
@curseg ends
include codeseg.inc
.
.
.
call screenbytes
mov ebx,eax
sys GetMemNear
jc drat ; jump if error control needed
mov saved_pointer,esi
call getscreen ; save the screen
.
.
.
mov esi,saved_pointer
call putscreen ; restore the initial screen
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
SHOWTPAGE: change video page shown on screen
Source: tpage.asm (crtinfo.asm, $herc.asm)
Call with: BL = page number
Returns: AX = error code
0 = no error
-1 = bad page number
Uses: AX
Supports: All ASM32 text modes (except MDA equipment, some RamFont modes)
Example: mov bl,1 ; show page 1
call showtpage
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
SNOWOFF: disables CGA snow control
SNOWON: enables CGA snow control (ASM32 default)
Source: crtinfo.asm
Call with: no parameters
Returns: nothing
Uses: no registers or flags
Example:
extrn snowoff:near
extrn getcrt:near
include codeseg.inc
; code
.
.
.
call getcrt
cmp ax,2 ; ASM32 doesn't disable snow control
; on MCGA systems
jne short continue
call snowoff ; MCGA doesn't need snow control
continue:
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
STR2VBUF: copies a string to video memory buffer, with selected
color attribute; includes snow control for CGA systems
Source: str2vbuf.asm
Call with: ECX = maximum number of characters to print (will also stop
at NUL character)
DX = 0 to disable snow control
= 3DAh to enable CGA snow control
(if DX = 3DAh on systems without a color monitor,
the computer will jam up solid)
ESI points to first character of string
ES:[EDI] points to video buffer
AH = color attribute
DF = 0 (clear direction flag with CLD)
Returns: EDI points to video buffer following string
if AL = 0
ESI points to byte following string's NUL terminator
if AL <> 0
ESI points to next byte in string after the last one
printed on the screen
Uses: AL, ECX, EDI, ESI, flags
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TCENTER: prints a string on the screen, centered horizontally
TNCENTER: prints ECX bytes of a string on the screen, centered horizontally
Source: tcenter.asm (crtinfo.asm, str2vbuf.asm, strlen.asm)
Call with: ESI pointing to the string
DH = row to print the string on
AH = color attribute
(tncenter only) ECX = number of bytes to print
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
lea esi,string ; ESI points to the string
mov dh,row
mov ah,attr ; color attribute
call tcenter ; center the string on row in DH
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TCLEAR: clear a text-mode screen with specified color attribute
Source: tclear.asm (crtinfo.asm, a$putw.asm)
Call with: AH = color attribute
Returns: nothing
Uses: AL
Supports: all ASM32 text modes; includes CGA snow control
Example: mov ah,color
call tclear
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TCOPY: copies one page of text-mode video memory to another page
Source: tcopy.asm (crtinfo.asm, tpage.asm, $herc.asm)
Call with: BH = frompage, BL = topage
Returns: if CF = 0, all OK
if CF = 1 and AH = -1, frompage number is out-of-bounds
if CF = 1 and AL = -1, topage number is out-of-bounds
Uses: EAX, CF
Supports: all ASM32 text modes, pages 0 - 15; includes CGA snow control
Example: mov bh,0 ; frompage
mov bl,1 ; copy from page 0 to page 1
call tcopy
jc oops ; oh yuck - an MDA
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TFILL: fill a text-mode screen with specified character and color
Source: tclear.asm (crtinfo.asm, a$putw.asm)
Call with: AH = color attribute, AL = fill character
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
mov ah,color
mov al,char ; AL = character to fill screen
call tfill
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TGETCHR: read character and attribute from text screen
Source: tgetchr.asm (crtinfo.asm)
Call with: DH = screen row
DL = screen column
Returns: AH = color attribute
AL = ASCII character code
Supports: all ASM32 text modes; includes CGA snow control
Example:
extrn tgetchr:near
include dataseg.inc
; data
position label word
column db 13
row db 18
@curseg ends
include codeseg.inc
; code
.
.
.
mov dx,position
call tgetchr ; returns with AL = ASCII character code
; and with AH = color attribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TLOAD: loads a screen image disk file saved by TSave
Source: tload.asm (crtinfo.asm)
Call with: EDX = address of ASCIIZ filename in low memory
Returns: if CF = 1, AX = MS-DOS file I/O error code
if CF = 0, no error
Uses: EAX, CF
Supports: all ASM32 text modes; no CGA snow control
see also TSave
Example:
extrn tload:proc
include dataseg.inc
; data
filename db 'tscreen.bin',0
@curseg ends
include codeseg.inc
; code
.
.
.
lea edx,filename
call tload
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPAGE: changes active page and shows new active page
Source: tpage.asm (crtinfo.asm, $herc.asm)
Call with: BL = page number
for ASM32 subroutines writing directly to video memory.
See also UseTPage and ShowTPage. ASM32's active page is
not affected by INT 10h mode changes.
Page -1 may be used on two-monitor systems, directs ASM32
video output to Monochrome screen (except cursor).
Returns: AX = error code
if AX = 0, no error
if AX = -1, bad page number
if AX = 1, page may be written to but cannot be shown
Uses: AX
Supports: text-mode screens, all row/column configurations
Example: mov bl,page
call tpage
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPRINT: print ASCIIZ string directly to video buffer.
String must be terminated by a NUL character. The string
may be in either low memory or high memory.
Source: tprint.asm (crtinfo.asm, str2vbuf.asm)
Call with: ESI pointing to the string
DH = screen row, DL = screen column
AH = color attribute
Returns: ECX = bytes printed
Uses: ECX
Supports: all ASM32 text modes; includes CGA snow control
Example:
lea esi,string ; ESI points to the string
mov dh,row
mov dl,column
mov ah,attr ; color attribute
call tprint
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPRINTCE: prints an ASCIIZ string on the screen at specified position
and specified color, and clears from the end of the string
to the right edge of the screen. The string may be in either
low memory or high memory.
Source: tprintce.asm (crtinfo.asm, str2vbuf.asm, a$putw.asm)
Call with: ESI pointing to the string
DH = screen row, DL = screen column
AH = color attribute
Returns: ECX = bytes ptrinted
Uses: ECX
Supports: all ASM32 text modes; includes CGA snow control
Example:
lea esi,string ; ESI points to the string
mov dh,row
mov dl,column
mov ah,attr ; color attribute
call tprintce
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPRINTL: print ASCIIZ string directly to video buffer, lower case
Source: tprintl.asm (crtinfo.asm)
TPRINTU: print ASCIIZ string directly to video buffer, upper case
Source: tprintu.asm (crtinfo.asm)
String must be terminated by a NUL character. Similar to TPrint,
but characters a - z are TPrinted as upper case A - Z (TPrintU)
or characters A - Z are TPrinted as lower case a - z (TPrintL).
The string itself is not altered.
Call with: ESI pointing to the string
DH = screen row, DL = screen column, AH = color attribute
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
lea esi,string ; ESI points to the string
mov dh,row
mov dl,column
mov ah,attr ; color attribute
call tprintu
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TPUTCHR: write character and attribute to screen
Source: tputchr.asm (crtinfo.asm)
Call with: AL = ASCII character
AH = color attribute
DH = screen row
DL = screen column
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
extrn tputchr:near
include dataseg.inc
; data
position label word
column db 13
row db 18
color db 32 ; white on blue background
@curseg ends
include codeseg.inc
; code
.
.
.
mov dx,position
mov ah,color
mov al,'#' ; character to write
call tgetchr ; returns with AL = ASCII character code
; and with AH = color attribute
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
TSAVE: saves a screen image as a disk file; does not compress the image
Source: tsave.asm (crtinfo.asm)
Call with: EDX = address of ASCIIZ filename in low memory
Returns: if CF = 1, AX = MS-DOS file I/O error code
if CF = 0, no error
Uses: EAX, CF
Supports: All ASM32 text modes; no CGA snow control
see also TLOAD
Example:
extrn tsave:proc
include dataseg.inc
; data
filename db 'tscreen.bin',0
@curseg ends
include codeseg.inc
; code
.
.
.
lea edx,filename
call tsave
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
UCURSORON: similar to CursorON, but the underscore cursor is used regardles
of the state of the INSERT toggle. See also CursorON.
Source: cursor.asm (crtinfo.asm)
Call with: DH = row offset from top of screen
DL = column offset from left side
Returns: nothing
Uses: AX
Supports: text mode, all pages, all row/column configurations
Example: mov dh,row
mov dl,col
call ucursoron
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
USETPAGE: establish ASM32's active page
Source: tpage.asm (crtinfo.asm, $herc.asm)
Call with: BL = page number
ASM32 text-mode subroutines can be directed to any video
page. ASM32's active page is not affected by INT 10h
mode changes. UseTPage does not change the page shown
on the screen. See also TPage and ShowTPage.
If newpage = -1, ASM32 video output is directed to a
Monochrome screen
Returns: AX = error code
if AX = -1, bad page number
Uses: AX, ES
Supports: All ASM32 text modes
Example: mov bl,page
call usetpage
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
VSCROLL: scroll a portion of the screen up or down.
Source: vscroll.asm ($wdata.asm, $wcopy.asm, a$putw.asm)
Call with: EBX pointing to corners of scroll area
AH = color attribute, ECX = number of rows to scroll
Scrolls up if ECX > 0, scrolls down if ECX < 0, clears area
if ECX = 0
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
; (row0, column0) = upper left corner
dw 20 ; row1
dw 40 ; column1
; (row1, column1) = lower right corner
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,color
mov ecx,3 ; scroll up 3 rows
call vscroll
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WCLEAR: clear a rectangular portion of a text-mode screen
Source: wclear.asm ($wdata.asm, crtinfo.asm, a$putw.asm)
Call with: EBX pointing to box corner data
AH = color attribute
Returns: nothing
Uses: AL, flags
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,color
call wclear ; clear a box on the screen with corners
; at (row0, column0), (row1, column0),
; (row0, column1) and (row1, column1)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WFILL: fill a rectangular protion of a text-mode screen with
specified character and attribute; variation of WClear
Source: wclear.asm ($wdata.asm, crtinfo.asm, a$putw.asm)
Call with: EBX pointing to box corner data
AH = color attribute
AL = fill character
Returns: nothing
Uses: flags
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0: top of fill area
dw 10 ; column0: left side of fill area
dw 20 ; row1: last row of fill area
dw 40 ; column1: right side of fill area
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,color
mov al,'■' ; use ASCII 254 to fill
call wfill ; fill a box on the screen with corners
; at (row0, column0), (row1, column0),
; (row0, column1) and (row1, column1)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WFRAME: draw a box on a text-mode screen
Source: wframe.asm (a$wdata.asm, a$putw.asm, crtinfo.asm)
Call with: EBX pointing to box corner data
AH = color attribute
AL = box character
box character is the character associated with an ASCII code
if AL = 0, a single line is used
if AL = -1, a double line is drawn
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,color
mov al,'■' ; use ASCII 254 for boundary
call wframe ; draw a box on the screen with corners
; at (row0, column0), (row1, column0),
; (row0, column1) and (row1, column1)
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WSIZE: calculate the memory required to save a screen window
Source: wsize.asm
Call with: EBX pointing to row & column coordinates
The row and column coordinates define the corners of the
window.
Returns: EAX = bytes required
Uses: EAX
Supports: All ASM32 text modes
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
call wsize ; returns EAX = bytes required
mov ebx,eax
sys GetMemNear
jc oh_no ; big problem if no space!
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WPAINT: replace all color attributes in a window of the screen
Source: wpaint.asm ($wdata.asm, crtinfo.asm, $paint.asm)
Call with: EBX pointing to window coordinates
AH = new color attribute
Returns: nothing
Uses: nothing; all registers and flags are saved
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,color ; AH = new color attribute
call wpaint
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WPRINT: print ASCIIZ string directly to the video buffer in a
window of screen, with word wrap. String must be terminated
by a NUL character. WPrint clears any portion of the window
not occupied by the string.
Source: WPRINT.ASM (crtinfo.asm, str2vbuf.asm, strlen.asm, $wdata.asm,
a$putw.asm)
Call with: ESI pointing to the string
EBX pointing to window corners
AH = color attribute
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
extrn wframe:proc, wprint:proc
include dataseg.inc
; data
wdata dw 10,10,20,30 ; window corner data: upper left at row 10,
; column 10; lower right at row 20, column 30
string db "The quick brown fox jumped over the lazy dog's back",0
@curseg ends
include codeseg.inc
; code
.
.
.
lea esi,string ; ESI points to the string
lea ebx,wdata ; EBX points to corner data
mov ah,12 ; bright red!!
call wprint
dec wdata ; stretch the window borders a bit
dec wdata+2 ; so I can draw a frame around the silly text
inc wdata+4
inc wdata+6
mov al,-1 ; double-line border
mov ah,14 ; bright yellow
call wframe
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WRECOLOR: change selected color attributes in a window of the screen
Source: wrecolor.asm ($wdata.asm, crtinfo.asm, $recolor.asm)
Call with: EBX pointing to window corner data
AL = color attribute to be replaced
AH = new color attribute
Returns: nothing
Uses: nothing; all registers and flags are saved
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
@curseg ends
include codeseg.inc
; code
.
.
.
lea ebx,wdata ; EBX points to window coordinates
mov ah,newcolor ; AH = new color attribute
mov al,oldcolor ; AL = color to be replaced
call wrecolor ; replace oldcolor with newcolor
; within the window
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
WRESTORE: restore a portion of a text-mode screen from a buffer
WSAVE: save a portion of a text-mode screen to a buffer
(handy when using pop-up windows on the screen)
Source: wsave.asm ($wdata.asm, crtinfo.asm, $wcopy.asm)
Call with: EDI pointing to memory buffer
EBX pointing to corner data
The memory buffer must be sized to hold the entire window.
See wsize.
Returns: nothing
Uses: nothing
Supports: all ASM32 text modes; includes CGA snow control
Example:
include dataseg.inc
; data
wdata dw 10 ; row0
dw 10 ; column0
dw 20 ; row1
dw 40 ; column1
buffer dw 2000h ; oversize
@curseg ends
include codeseg.inc
; code
.
.
.
; save a part of the screen
lea ebx,wdata ; EBX points to window coordinates
lea edi,buffer ; point to buffer
call wsave
.
.
.
; sometime later ...
; restore the window saved earlier
lea ebx,wdata ; EBX points to window coordinates
lea edi,buffer ; point to buffer
call wrestore